home *** CD-ROM | disk | FTP | other *** search
- <refentry id="GimpUnitMenu" revision="19 Jan 2001">
- <refmeta>
- <refentrytitle>GimpUnitMenu</refentrytitle>
- <manvolnum>3</manvolnum>
- <refmiscinfo>LIBGIMP Library</refmiscinfo>
- </refmeta>
-
- <refnamediv>
- <refname>GimpUnitMenu</refname><refpurpose>Widget for selecting a <link linkend="GimpUnit">GimpUnit</link>.</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv><title>Synopsis</title>
- <synopsis>
-
-
-
- struct <link linkend="GimpUnitMenu-struct">GimpUnitMenu</link>;
- #define <link linkend="GIMP-UNIT-MENU-CAPS">GIMP_UNIT_MENU</link> (obj)
- <link linkend="GtkWidget">GtkWidget</link>* <link linkend="gimp-unit-menu-new">gimp_unit_menu_new</link> (const <link linkend="gchar">gchar</link> *format,
- <link linkend="GimpUnit">GimpUnit</link> unit,
- <link linkend="gboolean">gboolean</link> show_pixels,
- <link linkend="gboolean">gboolean</link> show_percent,
- <link linkend="gboolean">gboolean</link> show_custom);
- void <link linkend="gimp-unit-menu-set-unit">gimp_unit_menu_set_unit</link> (<link linkend="GimpUnitMenu">GimpUnitMenu</link> *gum,
- <link linkend="GimpUnit">GimpUnit</link> unit);
- <link linkend="GimpUnit">GimpUnit</link> <link linkend="gimp-unit-menu-get-unit">gimp_unit_menu_get_unit</link> (<link linkend="GimpUnitMenu">GimpUnitMenu</link> *gum);
-
- </synopsis>
- </refsynopsisdiv>
-
- <refsect1>
- <title>Object Hierarchy</title>
- <synopsis>
-
- <link linkend="GtkObject">GtkObject</link>
- +----<link linkend="GtkWidget">GtkWidget</link>
- +----<link linkend="GtkContainer">GtkContainer</link>
- +----<link linkend="GtkBin">GtkBin</link>
- +----<link linkend="GtkButton">GtkButton</link>
- +----<link linkend="GtkOptionMenu">GtkOptionMenu</link>
- +----GimpUnitMenu
- </synopsis>
-
- </refsect1>
-
-
- <refsect1>
- <title>Signal Prototypes</title>
- <synopsis>
-
- "<link linkend="GimpUnitMenu-unit-changed">unit-changed</link>"
- void user_function (<link linkend="GimpUnitMenu">GimpUnitMenu</link> *gimpunitmenu,
- <link linkend="gpointer">gpointer</link> user_data);
- </synopsis>
- </refsect1>
-
-
- <refsect1>
- <title>Description</title>
- <para>
- This widget provides a <link linkend="GtkOptionMenu">GtkOptionMenu</link> which contains a list of <link linkend="GimpUnit">GimpUnit</link>'s.
- </para>
- <para>
- You can specify the string that will be displayed for each unit by
- passing a printf-like <parameter>format</parameter> string to <link linkend="gimp-unit-menu-new">gimp_unit_menu_new</link>().
- </para>
- <para>
- The constructor also lets you choose if the menu should contain items
- for GIMP_UNIT_PIXEL, GIMP_UNIT_PERCENT and a "More..." item which will
- pop up a dialog for selecting user-defined units.
- </para>
- <para>
- Whenever the user selects a unit from the menu or the dialog, the
- "unit_changed" signal will be emitted.
- </para>
- </refsect1>
-
- <refsect1>
- <title>Details</title>
- <refsect2>
- <title><anchor id="GimpUnitMenu-struct">struct GimpUnitMenu</title>
- <programlisting>struct GimpUnitMenu;</programlisting>
- <para>
-
- </para></refsect2>
- <refsect2>
- <title><anchor id="GIMP-UNIT-MENU-CAPS">GIMP_UNIT_MENU()</title>
- <programlisting>#define GIMP_UNIT_MENU(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_UNIT_MENU, GimpUnitMenu))
- </programlisting>
- <para>
- Checks if the passed pointer is a pointer to a <link linkend="GimpUnitMenu">GimpUnitMenu</link> and
- performs the cast if valid.
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>obj</parameter> :</entry>
- <entry>The pointer to cast.
-
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="gimp-unit-menu-new">gimp_unit_menu_new ()</title>
- <programlisting><link linkend="GtkWidget">GtkWidget</link>* gimp_unit_menu_new (const <link linkend="gchar">gchar</link> *format,
- <link linkend="GimpUnit">GimpUnit</link> unit,
- <link linkend="gboolean">gboolean</link> show_pixels,
- <link linkend="gboolean">gboolean</link> show_percent,
- <link linkend="gboolean">gboolean</link> show_custom);</programlisting>
- <para>
- Creates a new <link linkend="GimpUnitMenu">GimpUnitMenu</link> widget.
- </para>
- <para>
- The <parameter>format</parameter> string supports the following percent expansions:</para>
- <para>
-
- <informaltable pgwide=1 frame="none" role="enum">
- <tgroup cols="2"><colspec colwidth="1*"><colspec colwidth="8*">
- <tbody>
-
- <row>
- <entry>% f</entry>
- <entry>Factor (how many units make up an inch)</entry>
- </row>
-
- <row>
- <entry>% y</entry>
- <entry>Symbol (e.g. "''" for GIMP_UNIT_INCH)</entry>
- </row>
-
- <row>
- <entry>% a</entry>
- <entry>Abbreviation</entry>
- </row>
-
- <row>
- <entry>% s</entry>
- <entry>Singular</entry>
- </row>
-
- <row>
- <entry>% p</entry>
- <entry>Plural</entry>
- </row>
-
- <row>
- <entry>%%</entry>
- <entry>Literal percent</entry>
- </row>
-
- </tbody></tgroup></informaltable>
-
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>format</parameter> :</entry>
- <entry> A printf-like format string which is used to create the unit
- strings.
- </entry></row>
- <row><entry align="right"><parameter>unit</parameter> :</entry>
- <entry> The initially selected unit.
- </entry></row>
- <row><entry align="right"><parameter>show_pixels</parameter> :</entry>
- <entry> <link linkend="TRUE-CAPS">TRUE</link> if the unit menu should contain an item for
- GIMP_UNIT_PIXEL.
- </entry></row>
- <row><entry align="right"><parameter>show_percent</parameter> :</entry>
- <entry> <link linkend="TRUE-CAPS">TRUE</link> in the unit menu should contain an item for
- GIMP_UNIT_PERCENT.
- </entry></row>
- <row><entry align="right"><parameter>show_custom</parameter> :</entry>
- <entry> <link linkend="TRUE-CAPS">TRUE</link> if the unit menu should contain a "More..." item for
- opening the user-defined-unit selection dialog.
- </entry></row>
- <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> A pointer to the new <link linkend="GimpUnitMenu">GimpUnitMenu</link> widget.
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="gimp-unit-menu-set-unit">gimp_unit_menu_set_unit ()</title>
- <programlisting>void gimp_unit_menu_set_unit (<link linkend="GimpUnitMenu">GimpUnitMenu</link> *gum,
- <link linkend="GimpUnit">GimpUnit</link> unit);</programlisting>
- <para>
- Sets a new <link linkend="GimpUnit">GimpUnit</link> for the specified <link linkend="GimpUnitMenu">GimpUnitMenu</link>.</para>
- <para>
-
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>gum</parameter> :</entry>
- <entry> The unit menu you want to set the unit for.
- </entry></row>
- <row><entry align="right"><parameter>unit</parameter> :</entry>
- <entry> The new unit.
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
- <refsect2>
- <title><anchor id="gimp-unit-menu-get-unit">gimp_unit_menu_get_unit ()</title>
- <programlisting><link linkend="GimpUnit">GimpUnit</link> gimp_unit_menu_get_unit (<link linkend="GimpUnitMenu">GimpUnitMenu</link> *gum);</programlisting>
- <para>
- Returns the <link linkend="GimpUnit">GimpUnit</link> the user has selected from the <link linkend="GimpUnitMenu">GimpUnitMenu</link>.</para>
- <para>
-
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>gum</parameter> :</entry>
- <entry> The unit menu you want to know the unit of.
- </entry></row>
- <row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> The unit the user has selected.
-
- </entry></row>
- </tbody></tgroup></informaltable></refsect2>
-
- </refsect1>
-
- <refsect1>
- <title>Signals</title>
- <refsect2><title><anchor id="GimpUnitMenu-unit-changed">The "unit-changed" signal</title>
- <programlisting>void user_function (<link linkend="GimpUnitMenu">GimpUnitMenu</link> *gimpunitmenu,
- <link linkend="gpointer">gpointer</link> user_data);</programlisting>
- <para>
- This signal is emitted whenever the user selects a <link linkend="GimpUnit">GimpUnit</link> from the
- <link linkend="GimpUnitMenu">GimpUnitMenu</link>.
- </para><informaltable pgwide=1 frame="none" role="params">
- <tgroup cols="2">
- <colspec colwidth="2*">
- <colspec colwidth="8*">
- <tbody>
- <row><entry align="right"><parameter>gimpunitmenu</parameter> :</entry>
- <entry>the object which received the signal.
-
- </entry></row>
- <row><entry align="right"><parameter>user_data</parameter> :</entry>
- <entry>user data set when the signal handler was connected.</entry></row>
- </tbody></tgroup></informaltable></refsect2>
- </refsect1>
-
-
- <refsect1>
- <title>See Also</title>
- <para>
- <link linkend="GimpUnit">GimpUnit</link>
- </para>
- <para>
- <link linkend="GimpSizeEntry">GimpSizeEntry</link>
- </para>
- </refsect1>
-
- </refentry>
-